<?php

namespace App\Http\Middleware;

use App\Exceptions\GeneralException;
use Closure;
use Symfony\Component\HttpKernel\Exception\GoneHttpException;

class Maintain
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if (app()->isDownForMaintenance()){
            throw new GeneralException('系统维护中');
        }
        return $next($request);
    }
}
